//
//  MSRequestClient.m
//  MSJD
//
//  Created by xiangbo on 2018/10/25.
//  Copyright © 2018 xiangbo. All rights reserved.
//

#import "MSRequestClient.h"

@implementation MSRequestClient

+ (NSURLSessionTask *)GET:(NSString *)path
               parameters:(id)parameters
        responseClassType:(Class)classType
                  success:(MSRequestSuccess)success
                  failure:(MSRequestFailed)failure{
    return [MSNetworkAPI GET:path domain:API_TOPHRMING parameters:parameters success:^(id responseObject) {
        if (success) {
            success([classType modelWithJSON:responseObject]);
        }
    } failure:failure];
}

+ (NSURLSessionTask *)POST:(NSString *)path
                parameters:(id)parameters
         responseClassType:(Class)classType
             responseCache:(MSRequestCache)cacheBlock
                   success:(MSRequestSuccess)success
                   failure:(MSRequestFailed)failure{
    return [MSNetworkAPI POST:path domain:API_TOPHRMING parameters:parameters isJsonData:NO responseCache:cacheBlock success:^(id responseObject) {
        if (success) {
            success([classType modelWithJSON:responseObject]);
        }
    } failure:failure];
}

@end
